<template>
    <div class="play-detail">
        <div class="left">
            <img class="pic" :style='{animationPlayState: $parent.$parent.playstate?"running":"paused" }' src="../assets/avatar.jpg" >
            <img class="disc" :style='{animationPlayState: $parent.$parent.playstate?"running":"paused" }' src="../assets/disc.png" >
            <img class="bar" :style='{transform: $parent.$parent.playstate?"":"rotate(-25deg)" }' src="../assets/player_bar.png">
            <h2>{{name}}</h2>
        </div>
        <div class="right">
            <h2 style="text-align:center">热门评论</h2>
            <div class="comment" v-for="item in comments" :key="item.id">
                <img src="../assets/avatar.jpg">
                <div class="nickName">{{item.username}}</div>
                <div class="content">{{item.content}}</div>
            </div>
        </div>
    </div>
</template>
<script>
import axios from 'axios'
export default {
    data() {
        return {
            name:'',
            comments:[{username:'IU',content:'GOOD LUCK TO YOU!'}]
        }
    },
    mounted() {
        // console.log(this.$route)
        let id = this.$route.query.id
        let url = 'http://127.0.0.1:3000/api/search/getbyid?id='+id
        axios.get(url).then(res=>{
            // console.log(res.data)
            this.name = res.data.data[0].title
        })
    },
}
</script>
<style lang="less" scoped>
.right{
    overflow: auto;
    float: right;
    width: 50%;
    height: 100%;
    padding: 20px;
    // background-color: tomato;
    .comment{
        width: 100%;
        margin-top: 30px;
        padding-inline: 50px;
        img{
            float: left;
            width: 50px;
            height: 50px;
            border-radius: 25px;
        }
        .nickName{
            font-size: 18px;
            margin-left: 10px;
            height: 50px;
            line-height: 50px;
            float: left;
        }
        .content{
            float: left;
            margin-left: 10px;
            width: 100%;
            padding-left: 50px;
            padding-bottom: 20px;
        }
    }
}
.left{
    position: relative;
    float: left;
    width: 50%;
    height: 100%;
    // background-color: transparent;
    .bar{
        // border: 1px solid black;
        transition: 1s;
        transform-origin: 10px 10px;
        left: 0;
        margin-top: 10px;
        position: absolute;
        width: 100px;
        margin-left: calc(50% - 25px);
    }
    .pic{
        animation: 5s play infinite normal linear;
        transition: 1s;
        // border: 1px solid black;
        transform-origin: 50% 50%;
        left:0;
        position: absolute;
        width: 190px;
        margin-left: calc(50% - 90px);
        margin-top: 150px;
    }
    .disc{
        animation: 5s play infinite normal linear;
        transition: 1s;
        // border: 1px solid black;
        transform-origin: 50% 50%;
        left:0;
        position: absolute;
        width: 300px;
        margin-left: calc(50% - 150px);
        margin-top: 100px;
    }
    h2{
        width: 100%;
        position: absolute;
        margin-top: 450px;
        text-align: center;
    }
}
@keyframes play {
    0%{
        transform: rotate(0deg);
    }
    100%{
        transform: rotate(360deg);
    }
}
.play-detail{
    // opacity: 0.8;
    position: relative;
    border: solid 1px silver;
    // background-color: rgba(0, 0, 0, .5);
    background-color:rgba(225, 225, 225, 0.5);
    opacity: 1;
    width: 100%;
    height: 100%;
}
</style>